[#ftl]
[@define "agile.UploaderEditor" "agile._MetadataEditor" "Uploader=dojox/form/Uploader,ValidationTextBox=dijit/form/ValidationTextBox"]
	[#assign templateString]	
	<table>		
		<tr><td><div style="width:200px" data-dojo-attach-point="imageUploader" data-dojo-type="dojox/form/Uploader" data-dojo-props='multiple:false,uploadOnSelect:true,url:"${context}/prototype10/command/upload.do?version=1.0"'></div>
		</td><td><div data-dojo-attach-point="clearNode" title="{i18n_clear}" class="agileClearButton"></div></td></tr>
	</table>
	[/#assign]
	templateString:"${templateString?js_string}"
	,acceptedMIME:""	
	,constructor:function(){
//		agile.requireX("dojox/form/Uploader");
//		agile.requireX("dojox.embed.Flash");
//		if(dojox.embed.Flash.available){
//		  dojo.require("dojox/form/uploader.plugins.Flash");
//		}else{
//		  dojo.require("dojox/form/uploader.plugins.IFrame");
//		}	
		// dojo.require("dojox/form/uploader.plugins.HTML5");
	}
	,init:function(){	
		//console.log("#######this.imageUploader=",this.imageUploader);
		this.editor = new InlineEditBox({width:"200px",noValueIndicator:this.tooltip,editor:"dijit/form/ValidationTextBox",editorParams:{regExp:".*"}},this.imageUploader.containerNode);
		this.editor.startup();
		style.set(this.editor.domNode,{width:"200px"});
		
		aspect.after(this.imageUploader,"onComplete",lang.hitch(this,function(fileNames){
//			console.log("########",fileNames);
			this.editor.reset1("value",fileNames);
			this.onChange(this.parse(fileNames),this.name,this.htmlName);
		}),true);		
		
		this.own(on(this.clearNode,"click",lang.hitch(this,function(){
			this.editor.reset1("value","");
			this.onChange("",this.name,this.htmlName);
		})));
	}
	,isValid:function(){
		return true;
	}
[/@]
